import host from "./host";

export function BannerList() {
    return new Promise(function (resolve, reject) {
        api.ajax({
            method: 'get',
            url: host.hostUrl + '/news/bannerlist'
        }, function (ret, err) {
            if (err) {
                reject(err)
            } else {
                resolve(ret);
            }
        })
    });
}

export function NewsList(data) {
    return new Promise(function (resolve, reject) {
        api.ajax({
            method: 'get',
            url: host.hostUrl + '/news/list',
            data: {
                values: data
            }
        }, function (ret, err) {
            if (err) {
                reject(err)
            } else {
                resolve(ret);
            }
        })
    });
}

export function NewsDetail(news_id) {
    return new Promise(function (resolve, reject) {
        api.ajax({
            method: 'get',
            url: host.hostUrl + '/news/detail',
            data: {
                values: {
                    news_id: news_id
                }
            }
        }, function (ret, err) {
            if (err) {
                reject(err)
            } else {
                resolve(ret);
            }
        })
    });
}